package com.earnings.okhttputils.utils.ui.dialog;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.Window;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.earnings.R;
import com.zhy.autolayout.utils.AutoUtils;


/**
 * Created by HOHO on 2017/5/8.
 */

public class ProgressDialog extends Dialog {

    private Activity act;
    private LinearLayout mView;


    /**
     * 初始化
     *
     * @param context
     */
    public ProgressDialog(Context context) {
        super(context, R.style.progress_dialog);
        this.act = (Activity) context;

        mView = (LinearLayout) act.getLayoutInflater().inflate(R.layout.dialog_progress, null,false);
        AutoUtils.auto(mView);
        requestWindowFeature(Window.FEATURE_NO_TITLE);


      // mView.findViewById(R.id.sumbit).setOnClickListener(this);
        // setCanceledOnTouchOutside(false);
        // setCancelable(false);
        // init();
    }
    public void setText(String text){
        ((TextView)mView.findViewById(R.id.text)).setText(text);
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Window window = this.getWindow();
        this. setCancelable(true);
        window.setBackgroundDrawableResource(android.R.color.transparent);

        window.setContentView(mView);
        window.setGravity( Gravity.CENTER); // 此处可以设置dialog显示的位置
        
        window.setLayout(300,300);
    }
}
